home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Time Control Sample"
- ClientHeight = 3570
- ClientLeft = 1530
- ClientTop = 2370
- ClientWidth = 3015
- Height = 3975
- Left = 1470
- LinkTopic = "Form1"
- ScaleHeight = 3570
- ScaleWidth = 3015
- Top = 2025
- Width = 3135
- Begin VB.CheckBox Check1
- Caption = "Blocking"
- Height = 195
- Left = 105
- TabIndex = 1
- Top = 600
- Value = 1 'Checked
- Width = 1230
- End
- Begin VB.CommandButton Command1
- Caption = "Get Time"
- Height = 375
- Left = 1680
- TabIndex = 0
- Top = 600
- Width = 1110
- End
- Begin VB.Label Label3
- Caption = "You must be connected to the Internet through a TCP/IP connection for this program to work."
- Height = 615
- Left = 120
- TabIndex = 4
- Top = 2880
- Width = 2775
- End
- Begin VB.Label Label2
- Caption = $"gettime.frx":0000
- Height = 1575
- Left = 120
- TabIndex = 3
- Top = 1080
- Width = 2775
- End
- Begin TimeLib.Time Time1
- Left = 2520
- Top = 0
- _Version = 327680
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- Blocking = 0 'False
- Host = "mit.edu"
- End
- Begin VB.Label Label1
- BackColor = &H00FFFFFF&
- Height = 225
- Left = 105
- TabIndex = 2
- Top = 210
- Width = 2685
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Command1_Click()
- ' Set the blocking flag according to
- ' user input.
- Time1.Blocking = Check1.Value
- ' Don't allow the user to get the
- ' time again until we're done.
- Command1.Enabled = False
- On Error Resume Next
- ' Attempt to get the system time from
- ' a time server.
- Time1.GetTime
- ' Is there a real error?
- If (Err <> 0 And Err <> 10035) Then
- ' Show the user.
- MsgBox Error
- Command1.Enabled = True
- Exit Sub
- End If
- ' If we used blocking, then we already
- ' have the time (no error).
- On Error GoTo 0
- If (Time1.Blocking = True) Then
- Label1.Caption = Time1.GMTTime
- Command1.SetFocus
- End If
- End Sub
- Private Sub Time1_Done(ErrorCode As Integer)
- ' We have the time now, display it and allow
- ' the user to press the get time button again.
- Command1.Enabled = True
- Command1.SetFocus
- Label1.Caption = Time1.GMTTime
- End Sub
-